package org.blade.personal.dao.base.jpa;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

import org.blade.personal.component.OrderBy;
import org.blade.personal.dao.base.Dao;
import org.blade.personal.mode.BaseEntity;
import org.blade.personal.utils.Pager;

/**
 * 
 * @author blade
 *
 * @param <T>
 * @param <ID>
 */
public interface JpaDao<T extends BaseEntity<ID>, ID extends Serializable> extends Dao<T, ID>{

	
	/**
	 * 
	 * @param sql
	 * @return
	 */
	public abstract int executeSql(String sql);
	
	/**
	 * 
	 * @param sql
	 * @param param
	 * @return
	 */
	public abstract  int executeSql(String sql, Object... param);
	
	/**
	 * 
	 * @param sql
	 * @param param
	 * @return
	 */
	public abstract  int executeSql(String sql, Map<String, Object> param);
	
	
	/**
	 * 
	 * @param sql
	 * @param pager
	 * @return
	 */
	public abstract  List findObjectListBySql(String sql, Pager pager,Object... param);
	
	/**
	 * 
	 * @param sql
	 * @param pager
	 * @return
	 */
	public abstract  List findObjectListBySql(String sql, Pager pager);
	
	/**
	 * 
	 * @param pager
	 * @param param
	 * @return
	 */
	public abstract List<Map<String,Object>> pagination(String sql, Pager<T> pager , Map<String,Object> param );
	
	/**
	 * 根据实体类型获取实体列表，不分页
	 * @param entityClass
	 * @return
	 * 
	 */
	public abstract List<T> findList();		

	/**
	 * @param t
	 * @return
	 */
	public List<T> findList(OrderBy... order);
	/**
	 * @param t
	 * @param page
	 * @return
	 */
	public abstract List<T> findList(T t,Pager<T> page);
	
	/**
	 * @param t
	 * @param order
	 * @return
	 */
	public abstract List<T> findList(T t, OrderBy...order);
	/**
	 * @param page
	 * @param order
	 * @return
	 */
	public abstract List<T> findList(Pager<T> page, OrderBy...order);

	/**
	 * @param t
	 * @param page
	 * @param order
	 * @return
	 */
	public abstract List<T> findList(T t, Pager<T> page,OrderBy...order);
	/**
	 * @param entityClass
	 * @param sql
	 * @param page
	 * @param param
	 * @return
	 * 
	 */
	public abstract List<T> findListBySql(String sql, Pager<T> pager, Object... param);
	/**
	 * @param entityClass
	 * @param sql
	 * @param page
	 * @param param
	 * @return
	 * 
	 */
	public abstract List<T> findListByMapParamSql(String sql, Pager<T> page, Map<String, Object> param);

}
